{template '_header'}
<div class="page-header">当前位置： <span class="text-primary">商品核销管理</span> </div>
<div class="page-content">
    <form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
        <input type="hidden" name="c" value="site" />
        <input type="hidden" name="a" value="entry" />
        <input type="hidden" name="m" value="mx_shop" />
        <input type="hidden" name="do" value="web" />
        <input type="hidden" name="r" value="store.verifygoods" />
        <div class="page-toolbar">
            <div class="col-sm-6" >
                <div class="input-group " >
                    {php echo tpl_daterange('buydate', array('sm'=>true,'placeholder'=>'购买时间'),true);}
                </div>
            </div>
            <div class="input-group " >
                <div class="input-group-select">
                    <select name='searchfield'  class='form-control  input-sm select-md'    >
                        <option value='goodtitle' {if $_GPC['searchfield']=='goodtitle'}selected{/if}>商品名称</option>
                        <option value='ordersn' {if $_GPC['searchfield']=='ordersn'}selected{/if}>订单号</option>
                        <option value='verifyid' {if $_GPC['searchfield']=='verifyid'}selected{/if}>核销ID</option>
                        <option value='store' {if $_GPC['searchfield']=='store'}selected{/if}>所属门店</option>
                    </select>
                </div>
                <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="请输入关键词" />
                    <span class="input-group-btn">
                    <button class="btn btn-primary" type="submit"> 搜索</button>
                </span>
            </div>
        </div>

    </form>
    {if count($list)>0}
    <table class="table table-responsive">
        <thead class="navbar-inner">
        <tr>
            <th style='width:70px;'>核销ID</th>
            <th style=';'>记次时商品信息</th>
            <th style='width:190px;'>订单单号</th>
            <th style='width:70px;'>总次数</th>
            <th style='width:120px;'>购买日期</th>
            <th style='width:65px;'>剩余次数</th>
            <th style='width:80px;'>可用门店</th>
            <th style='width:70px;'>是否有效</th>
            <th style='width:115px;'>操作</th>
        </tr>
        </thead>
        <tbody>
        {loop $list $item}
        <tr>
            <td>{$item['id']}</td>
            <td>
                <img src="{php echo tomedia($item['thumb'])}" style="width:30px;height:30px;padding1px;border:1px solid #ccc" onerror="this.src='../addons/mx_shop/static/images/nopic.png'"
                />
                {$item['title']}
            </td>
            <td>{$item['ordersn']}</td>
            <td>
                {if empty($item['limitnum'])}不限 {else}{php echo intval($item['limitnum'])}{/if}

            </td>
            <td>{php echo date('Y-m-d',$item['paytime'])}</td>
            <td>

                {if empty($item['limitnum'])}不限 {else}{php echo intval($item['limitnum']) - intval($item['verifynum'])}{/if}

            </td>
            <td>
                {if empty($item['storename'])}全部门店 {else}{$item['storename']}{/if}
            </td>
            <td>
                {if empty($item['invalid'])}可用 {else}失效{/if}
            </td>
            <td>

                {ifp 'store.verifygoods.view|store.verifygoods.edit'}
                <a  class='btn btn-default btn-sm btn-op btn-operation' href="{php echo webUrl('store/verifygoods/detail', array('id' => $item['id']))}">
                  <span data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑">
                         <i class='icow icow-bianji2'></i>
                    </span>
                </a>
                {/if}

                {ifp 'store.verifygoods.view|store.verifygoods.edit'}
                <a  class='btn btn-default btn-sm btn-op btn-operation' href="{php echo webUrl('store/verifygoods/verifygoodslog', array('id' => $item['id']))}" >
                     <span data-toggle="tooltip" data-placement="top" title="" data-original-title="核销记录管理">
                         <i class='icow icow-zhongdiangongchengzongliangluru'></i>
                    </span>
                </a>
                {/if}

                {ifp 'store.verifygoods.edit'}
                    {if empty($item['invalid'])}
                    <a  class='btn btn-default btn-sm btn-op btn-operation' data-toggle='ajaxRemove' href="{php echo webUrl('store/verifygoods/invalid', array('id' => $item['id'],'type'=>1))}" data-confirm='将此商品状态设置为失效？ 失效后用户将无法核销此商品'>
                        <span data-toggle="tooltip" data-placement="top" title="" data-original-title="关闭">
                             <i class='icow icow-jinyong'></i>
                        </span>
                    </a>
                    {else}
                    <a  class='btn btn-default btn-sm btn-op btn-operation' data-toggle='ajaxRemove' href="{php echo webUrl('store/verifygoods/invalid', array('id' => $item['id'],'type'=>0))}" data-confirm='将此商品状态设置为有效？ 用户可用继续进行该商品的核销'>
                        <span data-toggle="tooltip" data-placement="top" title="" data-original-title="启用">
                             <i class='icow icow-qiyong'></i>
                        </span>
                    </a>
                    {/if}
                {/if}

            </td>
        </tr>
        {/loop}
        </tbody>
        <tfoot>
            <tr>
                <td colspan="9" class="text-right">{$pager}</td>
            </tr>
        </tfoot>
    </table>
{else}
    <div class='panel panel-default'>
        <div class='panel-body' style='text-align: center;padding:30px;'>
            暂时没有任何商品
        </div>
    </div>
{/if}
</div>

{template '_footer'}